//发送axios请求
import {request} from '@utils/http'
import{Key}from 'react'
import  {
    getHosSetListParamsType,
    getHosSetListReturnType,
    addHospitalParamType,
    getHosSetListItemsType,
    updateHospitalParamType

}from  './model/hospitalSetTypes'
//医院设置中 获取分页列表
export const getHosSetListRequest = ({page, limit, hosname, hoscode}:getHosSetListParamsType)=>{
    return request.get<any,getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`,{
        params:{
            hosname,
            hoscode
        }
    })
}

//医院设置中 新增医院请求
export const  addHospitalRequest = (data:addHospitalParamType)=>{
    return request.post<any,null>("/admin/hosp/hospitalSet/save",data)
}

//医院设置中，根据id获取获取某个详细的医院设置
export const getHosSetFromIdRequest = (id:string)=>{
    return request.get<any, getHosSetListItemsType>(`/admin/hosp/hospitalSet/get/${id}`)
}

//医院设置中，根据id修改后的数据 再次提交
export const updateHosSetFromIdRequest =(data:updateHospitalParamType)=>{
    return request.put("/admin/hosp/hospitalSet/update", data)
}
//删除事件
export const deleteHosSetFromIdRequest =(id:number)=>{
    return request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}
//批量删除
export const batchDeleteHosRequest  = (ids: Key[])=>{
    return request.delete<any,null>(`/admin/hosp/hospitalSet/batchRemove`,{
        data:ids
    })
}
